// 模拟登录API
export const mockLogin = async (credentials) => {
  return new Promise((resolve) => {
    setTimeout(() => {
      if (
        credentials.username === "admin" &&
        credentials.password === "123456"
      ) {
        localStorage.setItem(
          "currentUser",
          JSON.stringify({ username: credentials.username })
        );
        resolve(true);
      } else {
        resolve(false);
      }
    }, 1000);
  });
};

// 模拟注册API
export const mockRegister = async (userData) => {
  return new Promise((resolve) => {
    setTimeout(() => {
      // 这里可以添加真实的验证逻辑
      localStorage.setItem(
        "currentUser",
        JSON.stringify({ username: userData.username })
      );
      resolve(true);
    }, 1000);
  });
};
